package org.komarichin.jpa.dao;

import org.komarichin.jpa.entity.INews;

import java.io.Serializable;
import java.util.List;

/**
 * User: Michael Komarichin
 * Date: 28.09.2009
 * Time: 12:00:37
 */
public interface INewsDAO extends Serializable {
    /**
     * find news by it id
     *
     * @param id news id
     * @return found news
     */
    INews getNewsById(Long id);

    /**
     * create empty news entity object
     *
     * @return empty news
     *         Deprecated not use this method, becoth instanceing object must do for example spring object factory
     */
    @Deprecated
    INews createEmptyNews();

    /**
     * @return all news in list, if news not exists then list will empty with size 0
     */
    List<INews> getAll();

    /**
     * @param object save persistence news
     */
    void save(INews object);

    /**
     * @param object update news
     */
    void update(INews object);

    /**
     * @param object save or update news if news exists then it will be save
     */
    void saveOrUpdate(INews object);

    /**
     * @param object delete news
     */
    void delete(INews object);
}
